/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_historiquechangementsalaire")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvHistoriquechangementsalaire.findAll", query = "SELECT c FROM CvHistoriquechangementsalaire c"),
    @NamedQuery(name = "CvHistoriquechangementsalaire.findById", query = "SELECT c FROM CvHistoriquechangementsalaire c WHERE c.id = :id"),
    @NamedQuery(name = "CvHistoriquechangementsalaire.findByDatedebut", query = "SELECT c FROM CvHistoriquechangementsalaire c WHERE c.datedebut = :datedebut"),
    @NamedQuery(name = "CvHistoriquechangementsalaire.findByDatefin", query = "SELECT c FROM CvHistoriquechangementsalaire c WHERE c.datefin = :datefin"),
    @NamedQuery(name = "CvHistoriquechangementsalaire.findBySalaire", query = "SELECT c FROM CvHistoriquechangementsalaire c WHERE c.salaire = :salaire")})
public class CvHistoriquechangementsalaire implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "datedebut")
    @Temporal(TemporalType.DATE)
    private Date datedebut;
    @Column(name = "datefin")
    @Temporal(TemporalType.DATE)
    private Date datefin;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @Column(name = "salaire")
    private BigDecimal salaire;
    @JoinColumn(name = "travailleur_id", referencedColumnName = "cv_travailleur_id")
    @ManyToOne(fetch = FetchType.LAZY)
    private CvTravail travailleurId;
    @OneToMany(mappedBy = "derniersalairetoucher", fetch = FetchType.LAZY)
    private List<CvHistoriquechangementsalaire> cvHistoriquechangementsalaireList;
    @JoinColumn(name = "derniersalairetoucher", referencedColumnName = "id")
    @ManyToOne(fetch = FetchType.LAZY)
    private CvHistoriquechangementsalaire derniersalairetoucher;

    public CvHistoriquechangementsalaire() {
    }

    public CvHistoriquechangementsalaire(Integer id) {
        this.id = id;
    }

    public CvHistoriquechangementsalaire(Integer id, Date datedebut, BigDecimal salaire) {
        this.id = id;
        this.datedebut = datedebut;
        this.salaire = salaire;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDatedebut() {
        return datedebut;
    }

    public void setDatedebut(Date datedebut) {
        this.datedebut = datedebut;
    }

    public Date getDatefin() {
        return datefin;
    }

    public void setDatefin(Date datefin) {
        this.datefin = datefin;
    }

    public BigDecimal getSalaire() {
        return salaire;
    }

    public void setSalaire(BigDecimal salaire) {
        this.salaire = salaire;
    }

    public CvTravail getTravailleurId() {
        return travailleurId;
    }

    public void setTravailleurId(CvTravail travailleurId) {
        this.travailleurId = travailleurId;
    }

    @XmlTransient
    @JsonIgnore
    public List<CvHistoriquechangementsalaire> getCvHistoriquechangementsalaireList() {
        return cvHistoriquechangementsalaireList;
    }

    public void setCvHistoriquechangementsalaireList(List<CvHistoriquechangementsalaire> cvHistoriquechangementsalaireList) {
        this.cvHistoriquechangementsalaireList = cvHistoriquechangementsalaireList;
    }

    public CvHistoriquechangementsalaire getDerniersalairetoucher() {
        return derniersalairetoucher;
    }

    public void setDerniersalairetoucher(CvHistoriquechangementsalaire derniersalairetoucher) {
        this.derniersalairetoucher = derniersalairetoucher;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvHistoriquechangementsalaire)) {
            return false;
        }
        CvHistoriquechangementsalaire other = (CvHistoriquechangementsalaire) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvHistoriquechangementsalaire[ id=" + id + " ]";
    }
    
}
